﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using IterationLife.UserProfiles.Models;
using Util.Domains;

namespace IterationLife.FootballProfiles.Models {
    /// <summary>
    /// 用户足球资料
    /// </summary>
    [Description( "用户足球资料" )]
    public partial class UserFootballProfile : AggregateRoot<UserFootballProfile> {
        /// <summary>
        /// 初始化用户足球资料
        /// </summary>
        public UserFootballProfile() : this( Guid.Empty ) {
        }

        /// <summary>
        /// 初始化用户足球资料
        /// </summary>
        /// <param name="id">用户足球资料标识</param>
        public UserFootballProfile( Guid id ) : base( id ) {
        }

        /// <summary>
        /// 用户资料编号
        /// </summary>
        [Required(ErrorMessage = "用户资料编号不能为空")]
        public Guid UserProfileId { get; set; }
        /// <summary>
        /// 位置名称
        /// </summary>
        [StringLength( 20, ErrorMessage = "位置名称输入过长，不能超过20位" )]
        public string Position { get; set; }
        /// <summary>
        /// 位置编码
        /// </summary>
        [StringLength( 20, ErrorMessage = "位置编码输入过长，不能超过20位" )]
        public string PositionCode { get; set; }
        /// <summary>
        /// 球衣号
        /// </summary>
        [StringLength( 10, ErrorMessage = "球衣号输入过长，不能超过10位" )]
        public string FootballNumber { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreationTime { get; set; }
        
        /// <summary>
        /// 用户资料
        /// </summary>
        public virtual UserProfile UserProfile { get; set; }
        
        /// <summary>
        /// 添加描述
        /// </summary>
        protected override void AddDescriptions() {
            AddDescription( "用户足球资料编号", Id );
            AddDescription( "用户资料编号", UserProfileId );
            AddDescription( "位置名称", Position );
            AddDescription( "位置编码", PositionCode );
            AddDescription( "球衣号", FootballNumber );
            AddDescription( "创建时间", CreationTime );
        }
        
        /// <summary>
        /// 添加变更列表
        /// </summary>
        protected override void AddChanges( UserFootballProfile newEntity ) {
            AddChange( "Id", "用户足球资料编号", Id, newEntity.Id );            
            AddChange( "UserProfileId", "用户资料编号", UserProfileId, newEntity.UserProfileId );
            AddChange( "Position", "位置名称", Position, newEntity.Position );
            AddChange( "PositionCode", "位置编码", PositionCode, newEntity.PositionCode );
            AddChange( "FootballNumber", "球衣号", FootballNumber, newEntity.FootballNumber );
            AddChange( "CreationTime", "创建时间", CreationTime, newEntity.CreationTime );
        }
    }
}